#pragma once
#ifndef DRAWFUNC_H
#define DRAWFUNC_H


#define DRAWINHOUT 1
#define DRAWINBUFFER 2

class DrawFunc
{
	static DrawFunc* instance;
	SHORT screen_width;
	SHORT screen_height;
	HANDLE h_out;
	HANDLE buffer;
	COORD size;
	SMALL_RECT rc;
	CHAR_INFO  *chiBuffer;//用于画布缓存
	COORD coordBufSize;//用于画布缓存
	COORD coordBufCoord;//用于画布缓存
	SMALL_RECT srctReadRect;//用于后画布缓存
	SMALL_RECT srctWriteRect;//用于填充前画布缓存
	

public:
	
	static DrawFunc* Instance();
	static DrawFunc* Instance(SHORT s_w, SHORT s_h);
	DrawFunc(SHORT s_w, SHORT s_h);
	DrawFunc();
	~DrawFunc();


	 void Clean();
	 void Draw(int x, int y, char* str);
	 void Draw(int x, int y, int num);
	 void Draw(int x, int y, double num);

	 void CN_Draw(int x, int y, char* str);
	 void CN_Draw(int x, int y, int num);
	 void CN_Draw(int x, int y, double num);

	 void CN_Draw(int x, int y, char* str,int i);
	
	 void CN_DrawWithWhite(int x, int y, char* str, int i);
	 void CN_DrawWithWhite(int x, int y, int num, int i);
	
	 void CN_DrawWithGreen(int x, int y, char* str, int i);
	 void CN_DrawWithGreen(int x, int y, int num, int i);
	
	 void Flush();

};
#endif // !DRAWFUNC_H
